package bb.lanxing.device.sgdevcie.xpair.uimodel;

import android.bluetooth.BluetoothDevice;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.entity.MultiItemEntity;

import java.io.Serializable;
import java.util.Arrays;

import bb.lanxing.lib.devices.api.SmartDevice;
import bb.lanxing.lib.devices.core.utils.DeviceHelper;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;

public class BleDescriptionDevice implements MultiItemEntity, Serializable {
    public static Companion Companion = new Companion(null);
    private String address;
    private BluetoothDevice device;
    private int deviceType;
    private String fwVersion;
    private String hwVersion;
    private int itemType;
    private String manufacturer;
    private String model;
    private String name;
    private int rssi;
    private byte[] scanRecord;
    private String sn;

    public String component1() {
        return this.address;
    }

    public String component10() {
        return this.fwVersion;
    }

    public int component11() {
        return this.deviceType;
    }

    public int component12() {
        return getItemType();
    }

    public String component2() {
        return this.name;
    }

    public int component3() {
        return this.rssi;
    }

    public BluetoothDevice component4() {
        return this.device;
    }

    public byte[] component5() {
        return this.scanRecord;
    }

    public String component6() {
        return this.sn;
    }

    public String component7() {
        return this.manufacturer;
    }

    public String component8() {
        return this.model;
    }

    public String component9() {
        return this.hwVersion;
    }

    public BleDescriptionDevice copy(String address, String name, int i, BluetoothDevice device, byte[] bArr, String sn, String manufacturer, String model, String hwVersion, String fwVersion, int i2, int i3) {
        return new BleDescriptionDevice(address, name, i, device, bArr, sn, manufacturer, model, hwVersion, fwVersion, i2, i3);
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof BleDescriptionDevice)) {
            return false;
        }
        BleDescriptionDevice bleDescriptionDevice = (BleDescriptionDevice) obj;
        return Intrinsics.areEqual(this.address, bleDescriptionDevice.address) && Intrinsics.areEqual(this.name, bleDescriptionDevice.name) && this.rssi == bleDescriptionDevice.rssi && Intrinsics.areEqual(this.device, bleDescriptionDevice.device) && Intrinsics.areEqual(this.scanRecord, bleDescriptionDevice.scanRecord) && Intrinsics.areEqual(this.sn, bleDescriptionDevice.sn) && Intrinsics.areEqual(this.manufacturer, bleDescriptionDevice.manufacturer) && Intrinsics.areEqual(this.model, bleDescriptionDevice.model) && Intrinsics.areEqual(this.hwVersion, bleDescriptionDevice.hwVersion) && Intrinsics.areEqual(this.fwVersion, bleDescriptionDevice.fwVersion) && this.deviceType == bleDescriptionDevice.deviceType && getItemType() == bleDescriptionDevice.getItemType();
    }

    public int hashCode() {
        int hashCode = ((((((this.address.hashCode() * 31) + this.name.hashCode()) * 31) + this.rssi) * 31) + this.device.hashCode()) * 31;
        byte[] bArr = this.scanRecord;
        return ((((((((((((((hashCode + (bArr == null ? 0 : Arrays.hashCode(bArr))) * 31) + this.sn.hashCode()) * 31) + this.manufacturer.hashCode()) * 31) + this.model.hashCode()) * 31) + this.hwVersion.hashCode()) * 31) + this.fwVersion.hashCode()) * 31) + this.deviceType) * 31) + getItemType();
    }

    @NonNull
    public String toString() {
        return "BleDescriptionDevice(address=" + this.address + ", name=" + this.name + ", rssi=" + this.rssi + ", device=" + this.device + ", scanRecord=" + Arrays.toString(this.scanRecord) + ", sn=" + this.sn + ", manufacturer=" + this.manufacturer + ", model=" + this.model + ", hwVersion=" + this.hwVersion + ", fwVersion=" + this.fwVersion + ", deviceType=" + this.deviceType + ", itemType=" + getItemType() + ')';
    }

    public BleDescriptionDevice(String address, String name, int i, BluetoothDevice device, byte[] bArr, String sn, String manufacturer, String model, String hwVersion, String fwVersion, int i2, int i3) {
        this.address = address;
        this.name = name;
        this.rssi = i;
        this.device = device;
        this.scanRecord = bArr;
        this.sn = sn;
        this.manufacturer = manufacturer;
        this.model = model;
        this.hwVersion = hwVersion;
        this.fwVersion = fwVersion;
        this.deviceType = i2;
        this.itemType = i3;
    }

    public String getAddress() {
        return this.address;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String str) {
        this.name = str;
    }

    public int getRssi() {
        return this.rssi;
    }

    public BluetoothDevice getDevice() {
        return this.device;
    }

    public byte[] getScanRecord() {
        return this.scanRecord;
    }

    public String getSn() {
        return this.sn;
    }

    public void setSn(String str) {

        this.sn = str;
    }

    public String getManufacturer() {
        return this.manufacturer;
    }

    public void setManufacturer(String str) {

        this.manufacturer = str;
    }

    public String getModel() {
        return this.model;
    }

    public void setModel(String str) {

        this.model = str;
    }

    public String getHwVersion() {
        return this.hwVersion;
    }

    public void setHwVersion(String str) {

        this.hwVersion = str;
    }

    public String getFwVersion() {
        return this.fwVersion;
    }

    public void setFwVersion(String str) {

        this.fwVersion = str;
    }

    public int getDeviceType() {
        return this.deviceType;
    }

    public void setDeviceType(int i) {
        this.deviceType = i;
    }

    public BleDescriptionDevice(String str, String str2, int i, BluetoothDevice bluetoothDevice, byte[] bArr, String str3, String str4, String str5, String str6, String str7, int i2, int i3, int i4, DefaultConstructorMarker defaultConstructorMarker) {
        this(str, str2, i, bluetoothDevice, bArr, (i4 & 32) != 0 ? "" : str3, (i4 & 64) != 0 ? "" : str4, (i4 & 128) != 0 ? "" : str5, (i4 & 256) != 0 ? "" : str6, (i4 & 512) != 0 ? "" : str7, (i4 & 1024) != 0 ? 0 : i2, (i4 & 2048) != 0 ? Companion.getViewDeviceType(str2) : i3);
    }

    @Override
    public int getItemType() {
        return this.itemType;
    }

    public void setItemType(int i) {
        this.itemType = i;
    }

    public boolean isDisRead() {
        if (this.sn.length() > 0) {
            if (this.manufacturer.length() > 0) {
                if (this.model.length() > 0) {
                    if (this.hwVersion.length() > 0) {
                        if (this.fwVersion.length() > 0) {
                            return true;
                        }
                    }
                }
            }
        }
        return false;
    }

    public SmartDevice convertToSmartDevice() {
        SmartDevice deviceByAddress = DeviceHelper.getDeviceProvider().getDeviceByAddress(this.address);
        if (deviceByAddress == null) {
            deviceByAddress = DeviceHelper.getDeviceProvider().create();
        }
        deviceByAddress.setName(this.name);
        deviceByAddress.setAddress(this.address);
        deviceByAddress.setRssi(this.rssi);
        deviceByAddress.setScanRecord(this.scanRecord);
        deviceByAddress.setType(this.deviceType);
        deviceByAddress.setProtocol(1);
        Intrinsics.checkNotNullExpressionValue(deviceByAddress, "DeviceHelper.getDevicePr…er.PROTOCOL_BLE\n        }");
        return deviceByAddress;
    }


        public static class Companion {
        public Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        public void getSmartDeviceType() {
        }

        private Companion() {
        }

        public int getViewDeviceType(String deviceName) {
            Intrinsics.checkNotNullParameter(deviceName, "deviceName");
            String lowerCase = deviceName.toLowerCase();
            Intrinsics.checkNotNullExpressionValue(lowerCase, "this as java.lang.String).toLowerCase()");
            return StringsKt.contains((CharSequence) StringsKt.trim((CharSequence) lowerCase).toString(), (CharSequence) "dfu", false/*, 2, (Object) null*/) ? 1 : 2;
        }
    }
}
